package com.yunduansing.demo.service;

import com.yunduansing.demo.entity.UserEntity;
import com.yunduansing.demo.exception.MyException;
import com.yunduansing.demo.exception.RecordExistsException;
import com.yunduansing.demo.model.common.PageRequestModel;
import com.yunduansing.demo.model.common.PageResultModel;
import com.yunduansing.demo.model.user.UserAddModel;
import com.yunduansing.demo.model.user.UserImportModel;
import com.yunduansing.demo.model.user.UserPageModel;
import com.yunduansing.demo.model.user.UserPageRequestModel;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.IService;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author yunduansing
 * @since 2020-05-24
 */
public interface UserService extends IService<UserEntity> {
/**
     * 创建用户
     * @param model 用户模型
     * @return
     */
    boolean create(UserAddModel model) throws RecordExistsException;
    /**
     * 修改
     */
    boolean update(UserAddModel model) throws RecordExistsException;
    /**
     * 分页
     */
    PageResultModel<UserPageModel> getPage(UserPageRequestModel model);
    /**
     * 根据user id获取详细信息
     * @param id
     * @return
     */
    UserPageModel getDetailById(int id);
    /**
     * 导入数据
     */
    boolean importData(List<UserImportModel> data);
    /**
     * 重置密码
     * @param username
     * @param oldPassword
     * @param newPassword
     * @return
     * @throws RecordExistsException
     * @throws MyException
     */
    boolean resetPassword(String username,String oldPassword,String newPassword) throws RecordExistsException, MyException;
    /**
     * 根据姓名生成账号
     * @param fullName  姓名
     * @return
     */
    String createAccount(String fullName);
    /**
     * 初始化密码
     */
    boolean initPassword(List<Integer> userIds);
}
